// 输入数字逆转 输出汉字
const reverse = function () {
    let num = window.prompt('input');
    let str = "";
    for (let i = num.length - 1; i >= 0; i--) {
        str += transfer(num[i]);
    }
    console.log(str);
}

const transfer = function (target) {
    switch(target) {
        case "1" :
            return "壹";
        case "2":
            return "貮";      
    }
}

// 求阶乘 
// n! = n * (n -1)!
function jc(n) {
    if (n === 1 || n === 0) {
        return 1;
    }
    return n * jc(n - 1);
  }
console.log(jc(5));
//   斐波那楔数列
// fb(n) == fb(n - 1) + fb(n - 2)

function fb(v) {
    if (v == 1 ||v == 2) {
        return 1;
    }
    return fb(v - 1) + fb(v - 2);
  }
  console.log(fb(3));